const { downloadBook, parseBook } = require('../../lib/modules/book')
const { parseChapter } = require('../../lib/modules/chapter')
const source = require('./source.json')

const book = {
  name: '临高启明',
  author: '吹牛者',
  kind: '历史穿越',
  lastChapter: '第二百九十八节 融资（三）',
  introduce: '',
  coverUrl: 'https://www.280xs.com/files/article/image/11/11027/11027s.jpg',
  bookUrl: '/dingdian/11_11027/'
}

downloadBook(source, book.bookUrl).then(res => {
  console.log(res)
  const items = parseBook(source, res)
  items.chapters = parseChapter(source, res)

  return items
}).then(console.log)
